home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Tools / MorphOS / cvs-1.11.2 / source / amiga / amiga.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-18  |  9.1 KB  |  257 lines

  1. /*
  2.  * $Id$
  3.  *
  4.  * :ts=4
  5.  *
  6.  * AmigaOS wrapper routines for GNU CVS, using the RoadShow TCP/IP API
  7.  *
  8.  * Written and adapted by Olaf `Olsen' Barthel <olsen@sourcery.han.de>
  9.  *                        Jens Langner <Jens.Langner@light-speed.de>
  10.  *
  11.  * This program is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2 of the License, or
  14.  * (at your option) any later version.
  15.  *
  16.  * This program is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
  19.  * GNU General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with this program; if not, write to the Free Software
  23.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  */
  25.  
  26. #ifndef _AMIGA_H
  27. #define _AMIGA_H 1
  28.  
  29. /****************************************************************************/
  30.  
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <utime.h>
  34.  
  35. #if defined(__GNUC__)
  36. #include <sys/socket.h>
  37. #endif
  38.  
  39. #include <netinet/in.h>
  40. #include <sys/stat.h>
  41.  
  42. /****************************************************************************/
  43.  
  44. #if defined(__SASC)
  45. #define    ntohl(x)    (x)
  46. #define    ntohs(x)    (x)
  47. #define    htonl(x)    (x)
  48. #define    htons(x)    (x)
  49. #endif
  50.  
  51. /* First we undefine everything and then we redefine it... */
  52.  
  53. #undef S_IFMT
  54. #undef S_IFDIR
  55. #undef S_IFREG
  56. #undef S_ISLNK
  57. #undef S_ISFIFO
  58. #undef S_ISDIR
  59. #undef S_ISREG
  60. #undef S_ISCHR
  61. #undef S_ISSOCK
  62.  
  63. #undef S_ISUID
  64. #undef S_ISGID
  65. #undef S_ISVTX
  66.  
  67. #undef S_IRWXU
  68. #undef S_IRUSR
  69. #undef S_IWUSR
  70. #undef S_IXUSR
  71.  
  72. #undef S_IRWXG
  73. #undef S_IRGRP
  74. #undef S_IWGRP
  75. #undef S_IXGRP
  76.  
  77. #undef S_IRWXO
  78. #undef S_IROTH
  79. #undef S_IWOTH
  80. #undef S_IXOTH
  81.  
  82. #undef S_IFMT
  83. #undef S_IFIFO
  84. #undef S_IFDIR
  85. #undef S_IFBLK
  86. #undef S_IFREG
  87. #undef S_IFLNK
  88. #undef S_IFSOCK
  89.  
  90. /* redefining */
  91.  
  92. #define    S_ISUID    0004000        /* set user id on execution */
  93. #define    S_ISGID    0002000        /* set group id on execution */
  94. #define    S_ISVTX    0001000        /* save swapped text even after use */
  95.  
  96. #define    S_IRWXU    0000700        /* RWX mask for owner */
  97. #define    S_IRUSR    0000400        /* R for owner */
  98. #define    S_IWUSR    0000200        /* W for owner */
  99. #define    S_IXUSR    0000100        /* X for owner */
  100.  
  101. #define    S_IRWXG    0000070        /* RWX mask for group */
  102. #define    S_IRGRP    0000040        /* R for group */
  103. #define    S_IWGRP    0000020        /* W for group */
  104. #define    S_IXGRP    0000010        /* X for group */
  105.  
  106. #define    S_IRWXO    0000007        /* RWX mask for other */
  107. #define    S_IROTH    0000004        /* R for other */
  108. #define    S_IWOTH    0000002        /* W for other */
  109. #define    S_IXOTH    0000001        /* X for other */
  110.  
  111. #define    S_IFMT        0170000 /* type of file */
  112. #define    S_IFIFO   0010000 /* named pipe (fifo) */
  113. #define    S_IFCHR   0020000 /* character special */
  114. #define    S_IFDIR        0040000 /* directory */
  115. #define    S_IFBLK        0060000 /* block special */
  116. #define    S_IFREG        0100000 /* regular */
  117. #define    S_IFLNK        0120000 /* symbolic link */
  118. #define    S_IFSOCK    0140000 /* socket */
  119.  
  120. #define    S_ISDIR(m)    (((m) & S_IFMT) == S_IFDIR)    /* directory */
  121. #define    S_ISCHR(m)    (((m) & S_IFMT) == S_IFCHR)    /* char special */
  122. #define    S_ISREG(m)    (((m) & S_IFMT) == S_IFREG)    /* regular file */
  123. #define    S_ISLNK(m)    (((m) & S_IFMT) == S_IFLNK)    /* symbolic link */
  124. #define    S_ISFIFO(m)    (((m) & S_IFMT) == S_IFIFO)    /* fifo */
  125. #define    S_ISSOCK(m)    (((m) & S_IFMT) == S_IFSOCK)/* socket */
  126.  
  127. /****************************************************************************/
  128.  
  129. unsigned long amiga_umask(unsigned long mask);
  130. int amiga_geteuid(void);
  131. int amiga_getuid(void);
  132. int amiga_getgid(void);
  133. int amiga_getgroups(int gidsetlen, int * gidset);
  134. struct passwd * amiga_getpwuid(int uid);
  135. struct passwd * amiga_getpwnam(char *name);
  136. struct group * amiga_getgrnam(char *name);
  137. int amiga_gethostname(char * name,int namelen);
  138. int amiga_mkdir(const char *name,int mode);
  139. char * amiga_getlogin(void);
  140. int amiga_utime(const char * const name,const struct utimbuf * const time);
  141. int amiga_pclose(FILE * pipe);
  142. FILE * amiga_popen(const char * command, const char * mode);
  143. char * amiga_getpass(const char *prompt);
  144. unsigned amiga_sleep(unsigned seconds);
  145. int amiga_connect(int sockfd,struct sockaddr *name,int namelen);
  146. int amiga_dup(int sockfd);
  147. struct hostent * amiga_gethostbyname(char *name);
  148. struct servent * amiga_getservbyname(char *name,char *proto);
  149. int amiga_recv(int fd,void *buff,int nbytes,int flags);
  150. int amiga_send(int fd,const void * const buff,int nbytes,int flags);
  151. int amiga_shutdown(int fd,int how);
  152. int amiga_socket(int domain,int type,int protocol);
  153. char * amiga_strerror(int code);
  154. void * amiga_valloc(size_t bytes);
  155. int amiga_close(int fd);
  156. int amiga_symlink(const char * const to,const char * const from);
  157. int amiga_readlink(const char * const path,char *buf,int buf_size);
  158. unsigned long amiga_waitpid(unsigned long pid,int *stat_loc,int options);
  159. long amiga_getpid(void);
  160. int amiga_piped_child(char ** argv,int * to_fd_ptr,int * from_fd_ptr);
  161. int amiga_isabsolute(const char * const filename);
  162. char * amiga_last_component(const char * const path);
  163. int amiga_unlink_file_dir(const char * const f);
  164. int amiga_fncmp(const char * const n1,const char * const n2);
  165. void amiga_fnfold(const char * const name);
  166. int amiga_fold_fn_char(int c);
  167. void amiga_expand_wild(int argc,const char ** const argv,int * _argc,char *** _argv);
  168. int amiga_access(const char *name, int modes);
  169. int amiga_chdir(const char *path);
  170. int amiga_creat(const char *name, int prot);
  171. FILE *amiga_fopen(const char *name, const char *modes);
  172. int amiga_fstat(int fd,struct stat * st);
  173. int amiga_lstat(const char *name, struct stat *st);
  174. int amiga_stat(const char *name, struct stat *st);
  175. int amiga_open(const char *name, int mode, ...);
  176. void *amiga_opendir(const char *dir_name);
  177. int amiga_rename(const char *old, const char *new);
  178. int amiga_rmdir(const char *name);
  179. int amiga_unlink(const char *name);
  180. char * amiga_cvs_temp_name(void);
  181. FILE * amiga_cvs_temp_file(char **fname);
  182. int amiga_chmod(char *name,int mode);
  183. unsigned char *amiga_inet_ntoa(struct in_addr iaddr);
  184. char *amiga_getenv(const char *name);
  185. void amiga_abort(void);
  186.  
  187. /****************************************************************************/
  188.  
  189. #ifndef NO_NAME_REPLACEMENT
  190. #undef creat
  191. #undef access
  192. #undef open
  193. #define open  amiga_open
  194.  
  195. #undef getenv
  196. #define getenv(name)                    amiga_getenv(name)
  197. #undef close
  198. #define close(fd)                        amiga_close(fd)
  199. #define inet_ntoa(in_addr)                amiga_inet_ntoa(in_addr)
  200. #define chmod(name,mode)                amiga_chmod(name,mode)
  201. #define cvs_temp_name()                    amiga_cvs_temp_name()
  202. #define cvs_temp_file(fname)            amiga_cvs_temp_file(fname)
  203. #define access(name, modes)                amiga_access(name, modes)
  204. #define chdir(path)                        amiga_chdir(path)
  205. #define creat(name, prot)                amiga_creat(name, prot)
  206. #define fopen(name, modes)                amiga_fopen(name, modes)
  207. #undef lstat
  208. #define lstat(name, st)                    amiga_lstat(name, st)
  209. #define stat(name, st)                    amiga_stat(name, st)
  210. #define opendir(dir_name)                amiga_opendir(dir_name)
  211. #define rename(old, new)                amiga_rename(old, new)
  212. #define rmdir(name)                        amiga_rmdir(name)
  213. #define unlink(name)                    amiga_unlink(name)
  214. #define expand_wild(c,v,_c,_v)            amiga_expand_wild(c,v,_c,_v)
  215. #define isabsolute(filename)            amiga_isabsolute(filename)
  216. #define last_component(path)            amiga_last_component(path)
  217. #define unlink_file_dir(f)                amiga_unlink_file_dir(f)
  218. #define fncmp(n1,n2)                    amiga_fncmp(n1,n2)
  219. #define fnfold(name)                    amiga_fnfold(name)
  220. #define getpid()                        amiga_getpid()
  221. #define waitpid(pid,stat_loc,options)    amiga_waitpid(pid,stat_loc,options)
  222. #define readlink(path,buf,buf_size)        amiga_readlink(path,buf,buf_size)
  223. #define symlink(to,from)                amiga_symlink(to,from)
  224. #define valloc(bytes)                    amiga_valloc(bytes)
  225. #define sleep(seconds)                    amiga_sleep(seconds)
  226. #define getpass(prompt)                    amiga_getpass(prompt)
  227. #define pclose(pipe)                    amiga_pclose(pipe)
  228. #define popen(command, mode)            amiga_popen(command,mode)
  229. #define utime(name,time)                amiga_utime(name,time)
  230. #define strerror(code)                    amiga_strerror(code)
  231. #define umask(mask)                        amiga_umask(mask)
  232. #define geteuid()                        amiga_geteuid()
  233. #define getuid()                        amiga_getuid()
  234. #define getgid()                        amiga_getgid()
  235. #define getgroups(gidsetlen, gidset)    amiga_getgroups(gidsetlen, gidset)
  236. #define getpwuid(uid)                    amiga_getpwuid(uid)
  237. #define getpwnam(name)                    amiga_getpwnam(name)
  238. #define getgrnam(name)                    amiga_getgrnam(name)
  239. #define gethostname(name,namelen)        amiga_gethostname(name,namelen)
  240. #define mkdir(name,mode)                amiga_mkdir(name,mode)
  241. #define getlogin()                        amiga_getlogin()
  242. #define connect(sockfd,name,namelen)    amiga_connect(sockfd,name,namelen)
  243. #define dup(sockfd)                        amiga_dup(sockfd)
  244. #define gethostbyname(name)                amiga_gethostbyname(name)
  245. #define getservbyname(name,proto)        amiga_getservbyname(name,proto)
  246. #define recv(fd,buff,nbytes,flags)        amiga_recv(fd,buff,nbytes,flags)
  247. #define send(fd,buff,nbytes,flags)        amiga_send(fd,buff,nbytes,flags)
  248. #define shutdown(fd,how)                amiga_shutdown(fd,how)
  249. #define socket(domain,type,protocol)    amiga_socket(domain,type,protocol)
  250. #define fstat(fd,st)                    amiga_fstat(fd,st)
  251. #define abort()                            amiga_abort()
  252. #endif /* NO_NAME_REPLACEMENT */
  253.  
  254. /****************************************************************************/
  255.  
  256. #endif /* _AMIGA_H */
  257.